//
// Created by song on 15-12-20.
//

#include "Dialog.h"
#include <QLineEdit>
#include <QPushButton>

#include <QGridLayout>
using namespace cv;
Dialog::Dialog(QWidget *parent):QDialog(parent)
{
    label=new QLabel(this);
    Mat mat=imread("/home/song/Project/res/opencv/girl.jpg");
    label->setPixmap(QPixmap::fromImage(mat2Qimg(mat)));
    label->resize(label->pixmap()->size());
}

Dialog::~Dialog()
{

}

QImage Dialog::mat2Qimg(Mat mat)
{
    flip(mat,mat,1);
    cvtColor(mat,mat,CV_BGR2RGB);
    QImage qImage=QImage((const unsigned char*)(mat.data),mat.cols,mat.rows,mat.cols*mat.channels(),QImage::Format_RGB888);
    return qImage;
}
